<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of RoleDAO
 *
 * @author Hoan Vu
 */
class RoleDAO {
    public function getRole($id) {
        $table = new Role();
        $row = $table->fetchRow("id =".$id);
        return $row;
    }

    public function getRoleList() {
       $table = new Role();
       $row = $table->fetchAll($table->select()->where('status = ?',1));
       return $row;
    }

    public function addRole($array) {
        $roles = new Role();
        $roles->insert($array);
    }

    public function editRole($array) {
        $table = new Role();
        $where = $table->getAdapter()->quoteInto('id = ?', $array['id']);
        $table->update($array,$where);
    }

    public function deleteRole($id) {
        $table = new Role();
        $data = array("status" => 0);
        $where = $table->getAdapter()->quoteInto('id = ?', $id);
        $table->update($data, $where);
    }
}
?>
